#if !defined(AFX_EDITOREDITVIEW_H__497B6E5D_318F_46EF_8873_117A35B5AD89__INCLUDED_)
#define AFX_EDITOREDITVIEW_H__497B6E5D_318F_46EF_8873_117A35B5AD89__INCLUDED_

#pragma once

#include "CHEditView.h"
#include "CHTreeCtrl.h"
#include "CHEditCtrl.h"
#include "CHStrUtils.h"
#include "CatalogTreeCtrl.h"

class CEditorEditView : public CHEditView
{
protected:
	CEditorEditView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CEditorEditView)
	virtual ~CEditorEditView();
	virtual void OnTextNotFound (LPCTSTR lpszFind)
	{
		CHMessageBox("Can not find %s", lpszFind);
	}

public:
	void Refresh();
	void SetNodeInfo(PNODEINFO pNode)
	{
		m_pNode = pNode;
		m_pNodeEx = CCatalogTreeCtrl::GetNodeInfoEx(pNode);
	}

	BOOL LoadFile();
	BOOL SaveFile();
	BOOL SetReadOnly(BOOL bRead);
	BOOL IsReadOnly()
	{
		return GetEditCtrl()->IsReadOnly();
	}

protected:
	PNODEINFO	m_pNode;
	PNODEINFOEX	m_pNodeEx;
	DWORD		m_nSyntexId;

protected:
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CEditorEditView)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
	//}}AFX_VIRTUAL

protected:
	//{{AFX_MSG(CEditorEditView)
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnEditFormatpar();
	afx_msg void OnEditFormatline();
	afx_msg void OnEditFindNext();
	afx_msg void OnUpdateEditFindNext(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEditFormatline(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEditFormatpar(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EDITOREDITVIEW_H__497B6E5D_318F_46EF_8873_117A35B5AD89__INCLUDED_)
